package com.zelic.znn.core;

/**
 * @since 17/07/2011
 * @author zelic
 * Filename: TrainingExample.java
 * Description: Training example for network
 */

/**
 * Training example is used to hold data of a specific example
 * @author zelic
 */
public class TrainingExample {
    private int numInput;
    private int numOutput;
    private double[] input;
    private double[] output;
    
    /**
     * Get input of training example
     * @return input in double[]
     */
    public double[] getInput(){
        return input;
    }
    
    /**
     * Get output of training example
     * @return output in double[]
     */
    public double[] getOutput(){
        return output;
    }
    
    /**
     * Get number of input
     * @return number of input in int
     */
    public int getNumInput(){
        return numInput;
    }
    
    /**
     * get number of output
     * @return number of output in int
     */
    public int getNumOutput(){
        return numOutput;
    }
    
    
    /**
     * Constructor for Training Example
     * @param numInput: number of input
     * @param numOutput : number of output
     */
    public TrainingExample(int numInput, int numOutput){
        this.numInput = numInput;
        this.numOutput = numOutput;
        input = new double[numInput];
        output = new double[numOutput];
    }
    
    /**
     * 2nd contructor for TrainingExample
     * @param numInput : number of input
     * @param numOutput:  number of output
     * @param input: input vector
     * @param output : output vector
     */
    public TrainingExample(int numInput, int numOutput, double[] input, double[] output){
        this(numInput,numOutput);
        this.input = input.clone();
        this.output = output.clone();
    }
    
    /**
     * Set input vector for training example
     * @param data : input vector
     */
    public void setInput(double[] data){
        input = data.clone();
    }
    
    /**
     * Set output vector for training example
     * @param data : output vector
     */
    public void setOutput(double[] data){
        output = data.clone();
    }
}
